<?php

$col = array();
$col["title"] = "Reservation ID";
$col["name"] = "idorder";
$col["align"] = "center";
$col["width"] = "60";
$cols[] = $col;

$col = array();
$col["title"] = "Unique Code";
$col["name"] = "uniquecode";
$col["align"] = "center";
$cols[] = $col;

$col = array();
$col["title"] = "Name";
$col["name"] = "custname";
$col["align"] = "center";
$cols[] = $col;

$col = array();
$col["title"] = "Product";
$col["name"] = "productname";
$col["align"] = "center";
$col["width"] = "40";
$cols[] = $col;

$col = array();
$col["title"] = "Quantity";
$col["name"] = "quantity";
$col["align"] = "center";
$col["width"] = "250";
$cols[] = $col;

$col = array();
$col["title"] = "Pickup Date";
$col["name"] = "pickupdate";
$col["align"] = "center";
$col["width"] = "100";
$cols[] = $col;

$col = array();
$col["title"] = "Updated";
$col["name"] = "timestamp";
$col["align"] = "center";
$col["width"] = "250";
$cols[] = $col;

$col = array();
$col["title"] = "Status";
$col["name"] = "status";
$col["search"] = true;
$col["align"] = "center";
$cols[] = $col;

$col = array();
$col["title"] = "Product ID";
$col["name"] = "product_idproduct";
$col["search"] = false;
$col["align"] = "center";
$col["hidden"] = true;
$cols[] = $col;

$col = array();
$col["title"] = "Customer ID";
$col["name"] = "customer_idcustomer";
$col["search"] = false;
$col["align"] = "center";
$col["hidden"] = true;
$cols[] = $col;

$g = new jqgrid();
$grid["rowNum"] = 23;
$grid["rowList"] = array(23,35,50);
$grid["caption"] = "Crossline Reservations";
$grid["sortname"] = 'status';
$grid["sortorder"] = "asc";
$grid["viewrecords"] = true;
$grid["autowidth"] = true;
$grid["height"] = "535";
$grid["multiselect"] = false;
$grid["showhidecolumns"] = true;


$g->set_options($grid);


$g->set_actions(array(
    "add" => false,
    "edit" => false,
    "delete" => false,
    "rowactions" => false,
    "search" => "advance"
        )
);

//$e["on_insert"] = array("add_product", null, false);
//$e["on_update"] = array("update_product", null, false);
//$g->set_events($e);

$g->select_command = "SELECT o.*,CONCAT(c.lastname,' ',c.firstname,' ',c.middleinitial) as custname, p.name as productname 
                        FROM crossline.order o INNER JOIN customer c ON o.customer_idcustomer = c.idcustomer 
                        INNER JOIN product p ON o.product_idproduct = p.idproduct 
                        WHERE c.active=true";

$g->table = "order";

$g->set_columns($cols);

$out = $g->render("list1");
?>
